package com.autumn.security.auth;

/**
 * 短信认证登录
 * 
 * @author 杨昌国 2018-12-06 09:50:34
 */
public class SmsAuthenticationToken extends AbstractAuthenticationToken {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4544909392106771310L;

	private final String token;
	private final String identifyingCode;

	/**
	 * 
	 * @param token
	 * @param identifyingCode
	 */
	public SmsAuthenticationToken(String token, String identifyingCode) {
		this.token = token;
		this.identifyingCode = identifyingCode;
	}

	/**
	 * 
	 * @param token
	 * @param identifyingCode
	 * @param identityType
	 */
	public SmsAuthenticationToken(String token, String identifyingCode, String identityType) {
		super(identityType);
		this.token = token;
		this.identifyingCode = identifyingCode;
	}

	@Override
	public Object getPrincipal() {
		return this.getToken();
	}

	@Override
	public Object getCredentials() {
		return this.getIdentifyingCode();
	}

	/**
	 * 获取票据或手机号
	 * 
	 * @return
	 */
	public String getToken() {
		return token;
	}

	/**
	 * 获取验证码
	 * 
	 * @return
	 */
	public String getIdentifyingCode() {
		return identifyingCode;
	}

}
